package thread.test1Io;

import java.io.IOException;
import java.io.PipedInputStream;
import java.util.Arrays;

/**
 * Created by majian8 on 2019/6/9.
 */
public class PipedInThread extends Thread {
    PipedInputStream pis;

    public PipedInThread(PipedInputStream pis) {
        this.pis = pis;
    }
    @Override
    public void run() {
        byte [] bt=new byte[1024];
        int len=0;
        try {
            while((len=pis.read(bt))!=-1){
                System.out.println(Arrays.toString(bt));
            }

            pis.close();
        } catch (IOException e) {

            e.printStackTrace();
        }
    }
}
